﻿Imports log4net

Partial Class mtCmmtDetailPopup
    Inherits System.Web.UI.Page

    Public AlertText As String
    Public ScriptText As String
    Private Shared logger As ILog = LogManager.GetLogger("mtCmmtDetailPopup")

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        If Session("users") Is Nothing Then
            ScriptText = "<script> window.parent.TINY.box.hide();</script>"
        End If
        If IsPostBack = False Then
            L_CommentDetail.Text = "Commitment Detail"
            If Val(Request("mode")) = 1 Then
                tr_prod.Visible = False
                tr_cmmt.Visible = True
            Else
                tr_prod.Visible = True
                tr_cmmt.Visible = False
            End If
            'L_productCode.Text = Right(Request("ProdCode"), 8)
            L_ProductYear.Text = Request("PlanYear")
            L_CmmtCode.Text = Request("CmmtCode")
            L_CmmtYear.Text = Request("PlanYear")

            'Session("L_productCode") = L_productCode.Text
            Session("L_ProductYear") = L_ProductYear.Text
            Session("L_CmmtCode") = L_CmmtCode.Text
            Session("L_CmmtYear") = L_CmmtYear.Text

            L_ID.Text = Request("DMDID")
            If Val(L_ID.Text) <> 0 Then
                getData(Val(L_ID.Text))
            Else
                If Val(Request("mode")) = 1 Then
                    IDTxt.Text = L_CmmtCode.Text
                Else
                    ProdTxt.Text = L_CmmtCode.Text
                End If

            End If
        End If
    End Sub

    Protected Sub AddBtn_Click(sender As Object, e As ImageClickEventArgs) Handles AddBtn.Click
        'If IDTxt.Text = "" Then
        '    Alert("กรุณากรอก ID")
        '    Exit Sub
        'End If
        If ItemNoTxt.Text = "" Then
            Alert("กรุณากรอก Item No")
            Exit Sub
        End If
        If DescripTxt.Text = "" Then
            Alert("กรุณากรอก Description")
            Exit Sub
        End If
            'If EleDe1.Text <> "" And EleUn1.Text = "" Then
            '    Alert("คำอธิบาย 1 : กรุณากรอกช่องหน่วย")
            '    Exit Sub
            'ElseIf EleDe1.Text = "" And EleUn1.Text <> "" Then
            '    Alert("คำอธิบาย 1 : กรุณากรอกช่องคำอธิบาย")
            '    Exit Sub
            'End If
            'If EleDe2.Text <> "" And EleUn2.Text = "" Then
            '    Alert("คำอธิบาย 2 : กรุณากรอกช่องหน่วย")
            '    Exit Sub
            'ElseIf EleDe2.Text = "" And EleUn2.Text <> "" Then
            '    Alert("คำอธิบาย 2 : กรุณากรอกช่องคำอธิบาย")
            '    Exit Sub
            'End If
            'If EleDe3.Text <> "" And EleUn3.Text = "" Then
            '    Alert("คำอธิบาย 3 : กรุณากรอกช่องหน่วย")
            '    Exit Sub
            'ElseIf EleDe3.Text <> "" And EleUn3.Text <> "" Then
            '    Alert("คำอธิบาย 3 : กรุณากรอกช่องคำอธิบาย")
            '    Exit Sub
            'End If
            'If EleDe3.Text <> "" And EleUn3.Text = "" Then
            '    Alert("คำอธิบาย 3 : กรุณากรอกช่องหน่วย")
            '    Exit Sub
            'ElseIf EleDe3.Text = "" And EleUn3.Text <> "" Then
            '    Alert("คำอธิบาย 3 : กรุณากรอกช่องคำอธิบาย")
            '    Exit Sub
            'End If
            'If EleDe4.Text <> "" And EleUn4.Text = "" Then
            '    Alert("คำอธิบาย 4 : กรุณากรอกช่องหน่วย")
            '    Exit Sub
            'ElseIf EleDe4.Text = "" And EleUn4.Text <> "" Then
            '    Alert("คำอธิบาย 4 : กรุณากรอกช่องคำอธิบาย")
            '    Exit Sub
            'End If
            'If EleDe5.Text <> "" And EleUn5.Text = "" Then
            '    Alert("คำอธิบาย 5 : กรุณากรอกช่องหน่วย")
            '    Exit Sub
            'ElseIf EleDe5.Text = "" And EleUn5.Text <> "" Then
            '    Alert("คำอธิบาย 5 : กรุณากรอกช่องคำอธิบาย")
            '    Exit Sub
            'End If
            'If EleDe6.Text <> "" And EleUn6.Text = "" Then
            '    Alert("คำอธิบาย 6 : กรุณากรอกช่องหน่วย")
            '    Exit Sub
            'ElseIf EleDe6.Text = "" And EleUn6.Text <> "" Then
            '    Alert("คำอธิบาย 6 : กรุณากรอกช่องคำอธิบาย")
            '    Exit Sub
            'End If
            'If EleDe7.Text <> "" And EleUn7.Text = "" Then
            '    Alert("คำอธิบาย 7 : กรุณากรอกช่องหน่วย")
            '    Exit Sub
            'ElseIf EleDe7.Text = "" And EleUn7.Text <> "" Then
            '    Alert("คำอธิบาย 7 : กรุณากรอกช่องคำอธิบาย")
            '    Exit Sub
            'End If
            'If EleDe8.Text <> "" And EleUn8.Text = "" Then
            '    Alert("คำอธิบาย 8 : กรุณากรอกช่องหน่วย")
            '    Exit Sub
            'ElseIf EleDe8.Text = "" And EleUn8.Text <> "" Then
            '    Alert("คำอธิบาย 8 : กรุณากรอกช่องคำอธิบาย")
            '    Exit Sub
            'End If
            'If EleDe9.Text <> "" And EleUn9.Text = "" Then
            '    Alert("คำอธิบาย 9 : กรุณากรอกช่องหน่วย")
            '    Exit Sub
            'ElseIf EleDe9.Text = "" And EleUn9.Text <> "" Then
            '    Alert("คำอธิบาย 9 : กรุณากรอกช่องคำอธิบาย")
            '    Exit Sub
            'End If

            Dim adapter As New MasterDataSetTableAdapters.CmmtDetailsTableAdapter
            Dim check As Integer
            If Val(L_ID.Text) = 0 Then
                check = adapter.CheckExistCmmtDetail(L_CmmtCode.Text, Val(L_CmmtYear.Text), Trim(DescripTxt.Text))
            Else
                check = adapter.CheckExistUpdate(L_CmmtCode.Text, Val(L_CmmtYear.Text), Trim(DescripTxt.Text), Val(L_ID.Text))
            End If

            ' Response.Write(check)
            Dim pcode, pyear
            If L_productCode.Text = "" Then
                pcode = Nothing
                pyear = Nothing
            Else
                pcode = L_productCode.Text
                pyear = L_ProductYear.Text
            End If

            Dim enterflag As String = ""
            If EnterAmountFlagRadio.SelectedValue = "Y" Then
                enterflag = "Y"
            ElseIf EnterAmountFlagRadio.SelectedValue = "N" Then
                enterflag = "N"
            End If

            Dim idenflag_v As String = ""
            If IdentFlagCB.Checked = True Then
                idenflag_v = "Y"
            Else
                idenflag_v = "N"
            End If

            Dim Attachflag_v As String = ""
            If AttachFlagCB.Checked = True Then
                Attachflag_v = "Y"
            Else
                Attachflag_v = "N"
            End If

            Dim d1 As String = "" : Dim d2 As String = "" : Dim d3 As String = "" : Dim d4 As String = "" : Dim d5 As String = "" : Dim d6 As String = "" : Dim d7 As String = "" : Dim d8 As String = "" : Dim d9 As String = ""
            d1 = Dvalue1.Text.Trim.Replace(",", "")
            d2 = Dvalue2.Text.Trim(",", "")
            d3 = Dvalue3.Text.Trim(",", "")
            d4 = Dvalue4.Text.Trim(",", "")
            d5 = Dvalue5.Text.Trim(",", "")
            d6 = Dvalue6.Text.Trim(",", "")
            d7 = Dvalue7.Text.Trim(",", "")
            d8 = Dvalue8.Text.Trim(",", "")
            d9 = Dvalue9.Text.Trim(",", "")

            If Val(L_ID.Text) = 0 Then
                If Val(check) <> 0 Then
                    Alert("ข้อมูลซ้ำกับที่มีอยู่ กรุณาตรวจสอบ")
                    Exit Sub
                Else
                    If Val(Request("mode")) = 1 Then
                    adapter.InsertCmmtDetail(Val(ItemNoTxt.Text.Trim), DescripTxt.Text, Val(DeriveRateTxt.Text.Trim.Replace(",", "")), _
                                    If(EleDe1.Text.Trim = "", Nothing, EleDe1.Text), If(EleDe2.Text.Trim = "", Nothing, EleDe2.Text), If(EleDe3.Text.Trim = "", Nothing, EleDe3.Text), If(EleDe4.Text.Trim = "", Nothing, EleDe4.Text), If(EleDe5.Text.Trim = "", Nothing, EleDe5.Text), _
                                   If(EleDe6.Text.Trim = "", Nothing, EleDe6.Text), If(EleDe7.Text.Trim = "", Nothing, EleDe7.Text), If(EleDe8.Text.Trim = "", Nothing, EleDe8.Text), If(EleDe9.Text.Trim = "", Nothing, EleDe9.Text), _
                                   If(EleUn1.Text.Trim = "", Nothing, EleUn1.Text), If(EleUn2.Text.Trim = "", Nothing, EleUn2.Text), If(EleUn3.Text.Trim = "", Nothing, EleUn3.Text), If(EleUn4.Text.Trim = "", Nothing, EleUn4.Text), If(EleUn5.Text.Trim = "", Nothing, EleUn5.Text), _
                                   If(EleUn6.Text.Trim = "", Nothing, EleUn6.Text), If(EleUn7.Text.Trim = "", Nothing, EleUn7.Text), If(EleUn8.Text.Trim = "", Nothing, EleUn8.Text), If(EleUn9.Text.Trim = "", Nothing, EleUn9.Text), _
                                    enterflag, _
                                    If(d1.Length = 0, Nothing, Val(Dvalue1.Text)), If(d2.Length = 0, Nothing, Val(Dvalue2.Text)), If(d3.Length = 0, Nothing, Val(Dvalue3.Text)), If(d4.Length = 0, Nothing, Val(Dvalue4.Text)), If(d5.Length = 0, Nothing, Val(Dvalue5.Text)), _
                                   If(d6.Length = 0, Nothing, Val(Dvalue6.Text)), If(d7.Length = 0, Nothing, Val(Dvalue7.Text)), If(d8.Length = 0, Nothing, Val(Dvalue8.Text)), If(d9.Length = 0, Nothing, Val(Dvalue9.Text)), _
                                   idenflag_v, Attachflag_v, _
                                   Date.Now, Session("users"), _
                                    Nothing, Nothing, L_CmmtCode.Text, Val(L_CmmtYear.Text))
                        logger.Info("User " & Session("users") & " insert  item " & DescripTxt.Text & " for commitment " & L_CmmtCode.Text)
                    Else

                    adapter.InsertCmmtDetail(Val(ItemNoTxt.Text.Trim), DescripTxt.Text, Val(DeriveRateTxt.Text.Trim.Replace(",", "")), _
                                   If(EleDe1.Text.Trim = "", Nothing, EleDe1.Text), If(EleDe2.Text.Trim = "", Nothing, EleDe2.Text), If(EleDe3.Text.Trim = "", Nothing, EleDe3.Text), If(EleDe4.Text.Trim = "", Nothing, EleDe4.Text), If(EleDe5.Text.Trim = "", Nothing, EleDe5.Text), _
                                  If(EleDe6.Text.Trim = "", Nothing, EleDe6.Text), If(EleDe7.Text.Trim = "", Nothing, EleDe7.Text), If(EleDe8.Text.Trim = "", Nothing, EleDe8.Text), If(EleDe9.Text.Trim = "", Nothing, EleDe9.Text), _
                                  If(EleUn1.Text.Trim = "", Nothing, EleUn1.Text), If(EleUn2.Text.Trim = "", Nothing, EleUn2.Text), If(EleUn3.Text.Trim = "", Nothing, EleUn3.Text), If(EleUn4.Text.Trim = "", Nothing, EleUn4.Text), If(EleUn5.Text.Trim = "", Nothing, EleUn5.Text), _
                                  If(EleUn6.Text.Trim = "", Nothing, EleUn6.Text), If(EleUn7.Text.Trim = "", Nothing, EleUn7.Text), If(EleUn8.Text.Trim = "", Nothing, EleUn8.Text), If(EleUn9.Text.Trim = "", Nothing, EleUn9.Text), _
                                   enterflag, _
                                   If(d1.Length = 0, Nothing, Val(Dvalue1.Text)), If(d2.Length = 0, Nothing, Val(Dvalue2.Text)), If(d3.Length = 0, Nothing, Val(Dvalue3.Text)), If(d4.Length = 0, Nothing, Val(Dvalue4.Text)), If(d5.Length = 0, Nothing, Val(Dvalue5.Text)), _
                                  If(d6.Length = 0, Nothing, Val(Dvalue6.Text)), If(d7.Length = 0, Nothing, Val(Dvalue7.Text)), If(d8.Length = 0, Nothing, Val(Dvalue8.Text)), If(d9.Length = 0, Nothing, Val(Dvalue9.Text)), _
                                  idenflag_v, Attachflag_v, _
                                  Date.Now, Session("users"), _
                                   L_CmmtCode.Text, Val(L_CmmtYear.Text), Nothing, Nothing)
                        logger.Info("User " & Session("users") & " insert  item " & DescripTxt.Text & " for product " & L_CmmtCode.Text)

                    End If




                    Alert("บันทึกข้อมูลเรียบร้อยแล้ว")
                End If
            Else
                If Val(check) > 1 Then
                    Alert("ข้อมูลซ้ำกับที่มีอยู่ กรุณาตรวจสอบ")
                    Exit Sub
                Else
                If Val(Session("editmode")) = 1 Then
                    adapter.UpdateCmmtDetail(Val(ItemNoTxt.Text), DescripTxt.Text, Val(DeriveRateTxt.Text), _
                                        If(EleDe1.Text.Trim = "", Nothing, EleDe1.Text), If(EleDe2.Text.Trim = "", Nothing, EleDe2.Text), If(EleDe3.Text.Trim = "", Nothing, EleDe3.Text), If(EleDe4.Text.Trim = "", Nothing, EleDe4.Text), If(EleDe5.Text.Trim = "", Nothing, EleDe5.Text), _
                                        If(EleDe6.Text.Trim = "", Nothing, EleDe6.Text), If(EleDe7.Text.Trim = "", Nothing, EleDe7.Text), If(EleDe8.Text.Trim = "", Nothing, EleDe8.Text), If(EleDe9.Text.Trim = "", Nothing, EleDe9.Text), _
                                        If(EleUn1.Text.Trim = "", Nothing, EleUn1.Text), If(EleUn2.Text.Trim = "", Nothing, EleUn2.Text), If(EleUn3.Text.Trim = "", Nothing, EleUn3.Text), If(EleUn4.Text.Trim = "", Nothing, EleUn4.Text), If(EleUn5.Text.Trim = "", Nothing, EleUn5.Text), _
                                        If(EleUn6.Text.Trim = "", Nothing, EleUn6.Text), If(EleUn7.Text.Trim = "", Nothing, EleUn7.Text), If(EleUn8.Text.Trim = "", Nothing, EleUn8.Text), If(EleUn9.Text.Trim = "", Nothing, EleUn9.Text), _
                                        enterflag, _
                                        If(d1.Length = 0, Nothing, Val(Dvalue1.Text)), If(d2.Length = 0, Nothing, Val(Dvalue2.Text)), If(d3.Length = 0, Nothing, Val(Dvalue3.Text)), If(d4.Length = 0, Nothing, Val(Dvalue4.Text)), If(d5.Length = 0, Nothing, Val(Dvalue5.Text)), _
                                       If(d6.Length = 0, Nothing, Val(Dvalue6.Text)), If(d7.Length = 0, Nothing, Val(Dvalue7.Text)), If(d8.Length = 0, Nothing, Val(Dvalue8.Text)), If(d9.Length = 0, Nothing, Val(Dvalue9.Text)), _
                                        idenflag_v, Attachflag_v, _
                                        Date.Now, Session("users"), _
                                        Nothing, Nothing, IDTxt.Text, Val(L_CmmtYear.Text), Val(L_ID.Text))

                    logger.Info("User " & Session("users") & " update  item " & DescripTxt.Text & " for commitment " & L_CmmtCode.Text)
                Else
                    adapter.UpdateCmmtDetail(Val(ItemNoTxt.Text), DescripTxt.Text, Val(DeriveRateTxt.Text), _
                                        If(EleDe1.Text.Trim = "", Nothing, EleDe1.Text), If(EleDe2.Text.Trim = "", Nothing, EleDe2.Text), If(EleDe3.Text.Trim = "", Nothing, EleDe3.Text), If(EleDe4.Text.Trim = "", Nothing, EleDe4.Text), If(EleDe5.Text.Trim = "", Nothing, EleDe5.Text), _
                                        If(EleDe6.Text.Trim = "", Nothing, EleDe6.Text), If(EleDe7.Text.Trim = "", Nothing, EleDe7.Text), If(EleDe8.Text.Trim = "", Nothing, EleDe8.Text), If(EleDe9.Text.Trim = "", Nothing, EleDe9.Text), _
                                        If(EleUn1.Text.Trim = "", Nothing, EleUn1.Text), If(EleUn2.Text.Trim = "", Nothing, EleUn2.Text), If(EleUn3.Text.Trim = "", Nothing, EleUn3.Text), If(EleUn4.Text.Trim = "", Nothing, EleUn4.Text), If(EleUn5.Text.Trim = "", Nothing, EleUn5.Text), _
                                        If(EleUn6.Text.Trim = "", Nothing, EleUn6.Text), If(EleUn7.Text.Trim = "", Nothing, EleUn7.Text), If(EleUn8.Text.Trim = "", Nothing, EleUn8.Text), If(EleUn9.Text.Trim = "", Nothing, EleUn9.Text), _
                                        enterflag, _
                                        If(d1.Length = 0, Nothing, Val(Dvalue1.Text)), If(d2.Length = 0, Nothing, Val(Dvalue2.Text)), If(d3.Length = 0, Nothing, Val(Dvalue3.Text)), If(d4.Length = 0, Nothing, Val(Dvalue4.Text)), If(d5.Length = 0, Nothing, Val(Dvalue5.Text)), _
                                       If(d6.Length = 0, Nothing, Val(Dvalue6.Text)), If(d7.Length = 0, Nothing, Val(Dvalue7.Text)), If(d8.Length = 0, Nothing, Val(Dvalue8.Text)), If(d9.Length = 0, Nothing, Val(Dvalue9.Text)), _
                                        idenflag_v, Attachflag_v, _
                                        Date.Now, Session("users"), _
                                        ProdTxt.Text.Trim, Val(pyear), Nothing, Nothing, Val(L_ID.Text))

                    logger.Info("User " & Session("users") & " update  item " & DescripTxt.Text & " for product " & L_CmmtCode.Text)
                End If


                    Alert("แก้ไขข้อมูลเรียบร้อยแล้ว")
                End If
            End If
            ScriptText = "<script> window.parent.TINY.box.hide();</script>"
    End Sub
    Sub Alert(ByVal message As String)
        AlertText += "<script> alert('" & message & "');</script>"
    End Sub

    Sub getData(ByVal id As Decimal)
        Dim show As New MasterDataSetTableAdapters.CmmtDetailsTableAdapter
        Dim dt As New MasterDataSet.CmmtDetailsDataTable
        dt = show.GetDataByID(Val(L_ID.Text))

        For Each row As MasterDataSet.CmmtDetailsRow In dt
            If row.IsCmmt_PlanYearNull = False Then
                L_CmmtYear.Text = row.Cmmt_PlanYear
            End If

            If row.IsProduct_PlanYearNull = False Then
                L_CmmtYear.Text = row.Product_PlanYear
            End If


            If row.IsProduct_ProductCodeNull = False Then
                L_productCode.Text = row.Product_ProductCode
                tr_prod.Visible = True
                tr_cmmt.Visible = False
                Session("editmode") = 2
            Else
                tr_prod.Visible = False
                tr_cmmt.Visible = True
                Session("editmode") = 1
            End If
            If row.IsProduct_PlanYearNull = False Then
                L_ProductYear.Text = row.Product_PlanYear
            End If

            If row.IsCmmt_CmmtCodeNull = False Then
                IDTxt.Text = row.Cmmt_CmmtCode
            End If
            If row.IsProduct_ProductCodeNull = False Then
                ProdTxt.Text = row.Product_ProductCode
            End If
            ItemNoTxt.Text = row.ItemNo
            DescripTxt.Text = row.Description

            If row.IsElementDescription1Null = False Then
                EleDe1.Text = row.ElementDescription1
            End If
            If row.IsElementUnit1Null = False Then
                EleUn1.Text = row.ElementUnit1
            End If
            If row.IsDefaultValue1Null = False Then
                Dvalue1.Text = row.DefaultValue1
            End If

            If row.IsElementDescription2Null = False Then
                EleDe2.Text = row.ElementDescription2
            End If
            If row.IsElementUnit2Null = False Then
                EleUn2.Text = row.ElementUnit2
            End If
            If row.IsDefaultValue2Null = False Then
                Dvalue2.Text = row.DefaultValue2
            End If

            If row.IsElementDescription3Null = False Then
                EleDe3.Text = row.ElementDescription3
            End If
            If row.IsElementUnit3Null = False Then
                EleUn3.Text = row.ElementUnit3
            End If
            If row.IsDefaultValue3Null = False Then
                Dvalue3.Text = row.DefaultValue3
            End If

            If row.IsElementDescription4Null = False Then
                EleDe4.Text = row.ElementDescription4
            End If
            If row.IsElementUnit4Null = False Then
                EleUn4.Text = row.ElementUnit4
            End If
            If row.IsDefaultValue4Null = False Then
                Dvalue4.Text = row.DefaultValue4
            End If

            If row.IsElementDescription5Null = False Then
                EleDe5.Text = row.ElementDescription5
            End If
            If row.IsElementUnit5Null = False Then
                EleUn5.Text = row.ElementUnit5
            End If
            If row.IsDefaultValue5Null = False Then
                Dvalue5.Text = row.DefaultValue5
            End If

            If row.IsElementDescription6Null = False Then
                EleDe6.Text = row.ElementDescription6
            End If
            If row.IsElementUnit6Null = False Then
                EleUn6.Text = row.ElementUnit6
            End If
            If row.IsDefaultValue6Null = False Then
                Dvalue6.Text = row.DefaultValue6
            End If

            If row.IsElementDescription7Null = False Then
                EleDe7.Text = row.ElementDescription7
            End If
            If row.IsElementUnit7Null = False Then
                EleUn7.Text = row.ElementUnit7
            End If
            If row.IsDefaultValue7Null = False Then
                Dvalue7.Text = row.DefaultValue7
            End If

            If row.IsElementDescription8Null = False Then
                EleDe8.Text = row.ElementDescription8
            End If
            If row.IsElementUnit8Null = False Then
                EleUn8.Text = row.ElementUnit8
            End If
            If row.IsDefaultValue8Null = False Then
                Dvalue8.Text = row.DefaultValue8
            End If

            If row.IsElementDescription9Null = False Then
                EleDe9.Text = row.ElementDescription1
            End If
            If row.IsElementUnit9Null = False Then
                EleUn9.Text = row.ElementUnit1
            End If
            If row.IsDefaultValue9Null = False Then
                Dvalue9.Text = row.DefaultValue9
            End If

            If row.IsEnterAmountFlagNull = False Then
                If row.EnterAmountFlag = "Y" Then
                    EnterAmountFlagRadio.SelectedValue = row.EnterAmountFlag
                Else
                    EnterAmountFlagRadio.SelectedValue = row.EnterAmountFlag
                End If
            End If
            'If row.IsDefaultValue1Null = False Then
            '    Dvalue1.Text = row.DefaultValue1
            'End If
            'If row.IsDefaultValue2Null = False Then
            '    Dvalue2.Text = row.DefaultValue2
            'End If
            'If row.IsDefaultValue3Null = False Then
            '    Dvalue3.Text = row.DefaultValue3
            'End If
            'If row.IsDefaultValue4Null = False Then
            '    Dvalue4.Text = row.DefaultValue4
            'End If
            'If row.IsDefaultValue5Null = False Then
            '    Dvalue5.Text = row.DefaultValue5
            'End If
            'If row.IsDefaultValue6Null = False Then
            '    Dvalue6.Text = row.DefaultValue6
            'End If
            'If row.IsDefaultValue7Null = False Then
            '    Dvalue7.Text = row.DefaultValue7
            'End If
            'If row.IsDefaultValue8Null = False Then
            '    Dvalue8.Text = row.DefaultValue8
            'End If
            'If row.IsDefaultValue9Null = False Then
            '    Dvalue9.Text = row.DefaultValue9
            'End If

            If row.IsDeriveRateNull = False Then
                If row.DeriveRate <> "0.000000" Then
                    DeriveRateTxt.Text = row.DeriveRate
                End If
            End If

            If row.IsIdentificationFlagNull = False Then
                If row.IdentificationFlag = "Y" Then
                    IdentFlagCB.Checked = True
                ElseIf row.IdentificationFlag = "N" Then
                    IdentFlagCB.Checked = False
                End If
            End If
            If row.IsAttachmentFlagNull = False Then
                If row.AttachmentFlag = "Y" Then
                    AttachFlagCB.Checked = True
                ElseIf row.AttachmentFlag = "N" Then
                    AttachFlagCB.Checked = False
                End If

            End If

        Next
    End Sub


End Class
